<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 密码框，点击切换加密和不加密的效果 -->
    <input type="password" name="" id="pass" value="123456" class="pass" />
    <input type="button" name="" id="btn" value="点击显示" />
    <input type="button" value="点击隐藏" id="arr" />
    <script>
      var btn = document.getElementById('btn')
      var pass = document.getElementById('pass')
      var arr = document.getElementById('arr')
      btn.onclick = function () {
        pass.type = 'number'
      }
      arr.onclick = function () {
        pass.type = 'password'
      }
    </script>
  </body>
</html>
